using UnityEngine;
using System.Collections;

public class MoveAround : MonoBehaviour {

    public float _speed = 10.0f;

	// Use this for initialization
    void Start()
    {
        
    }
	
	// Update is called once per frame
	void Update () {
        CharacterController characterController = (CharacterController)GetComponent("CharacterController");

        // Move forward / backward
        Vector3 forward = GameObject.Find("CharacterCamera").transform.TransformDirection(Vector3.forward);
        float curSpeed = _speed * Input.GetAxis("Vertical");
        characterController.SimpleMove(forward * curSpeed * Time.deltaTime);

        // Move left / right
        Vector3 leftRight = GameObject.Find("CharacterCamera").transform.TransformDirection(Vector3.right);
        curSpeed = _speed * Input.GetAxis("Horizontal");
        characterController.SimpleMove(leftRight * curSpeed * Time.deltaTime);
	}
}
